package proto

import (
	"common"
	"core/models/entity"
	"framework/remote"
	"hall/models/response"
)

type GoodsRule struct {
	Session    *remote.Session
	GoodsOrder *entity.GoodsOrder
}

type MarketBuy struct {
	Session     *remote.Session
	MarketOrder *entity.MarketOrder
}

type VipBuy struct {
	Session  *remote.Session
	VipOrder *entity.VipOrder
}

type VipReceive struct {
	Session    *remote.Session
	VipReceive *entity.VipReceive
}

type SignReceive struct {
	Session    *remote.Session
	VipReceive *entity.VipReceive
	SignLog    *entity.UserSignLog
}

type InvestmentExchange struct {
	Session     *remote.Session
	InvExchange *entity.InvestmentExchangeLog
}

type MessageType int

const (
	GoodsNumNotify   MessageType = 301 //商城数量变更通知
	GoodsOrderNotify             = 302 //商城订单生成通知
	ProductionNotify             = 303 //生产完成通知
	VipOrderNotify               = 304 //vip订单生成通知
	UserNotify                   = 305 //用户信息变更通知
	MarketNotify                 = 306 //市场变更通知
	InvestmentNotify             = 307 //投资中心通知
	AbnormalNotify               = 404 //异常数据通知
)

func GoodsNumNotifyData(goods *response.GoodsList) any {
	pushMsg := map[string]any{
		"type":       GoodsNumNotify,
		"data":       goods,
		"pushRouter": "GoodsMessagePush",
	}
	return pushMsg
}

func GoodsOrderNotifyData(order *entity.GoodsOrder) any {
	pushMsg := map[string]any{
		"type":       GoodsOrderNotify,
		"data":       order,
		"pushRouter": "GoodsMessagePush",
	}
	return pushMsg
}

func ProductionNotifyData(info *response.ProductionList) any {
	pushMsg := map[string]any{
		"type":       ProductionNotify,
		"data":       info,
		"pushRouter": "ProductionMessagePush",
	}
	return pushMsg
}

func VipOrderNotifyData(order *entity.VipOrder) any {
	pushMsg := map[string]any{
		"type":       VipOrderNotify,
		"data":       order,
		"pushRouter": "ProductionMessagePush",
	}
	return pushMsg
}

func UserNotifyData(user *entity.User) any {
	pushMsg := map[string]any{
		"type":       UserNotify,
		"data":       user,
		"pushRouter": "ProductionMessagePush",
	}
	return pushMsg
}

func MarketNotifyData(order *entity.MarketOrder) any {
	pushMsg := map[string]any{
		"type":       MarketNotify,
		"data":       order,
		"pushRouter": "MarketMessagePush",
	}
	return pushMsg
}

func InvestmentNotifyData(data any) any {
	pushMsg := map[string]any{
		"type":       InvestmentNotify,
		"data":       data,
		"pushRouter": "InvestmentMessagePush",
	}
	return pushMsg
}

func AbnormalNotifyData(result common.Result) any {
	return map[string]any{
		"type":       AbnormalNotify,
		"data":       result,
		"pushRouter": "ErrorMessagePush",
	}
}
